package ch05;

public class PowerGenerator {
	
	private double factor;
	private double power = 1;
	
	public PowerGenerator (double f)
	{
		factor = f;
	}
	
	public double nextPower()
	{
		power *= factor;
		return power;
	}
	
	public double nextPower(int p)
	{
		for(int i = 0; i < p; i ++)
		{
			System.out.println(power);
			power *= factor;
		}
		
		return power;
	}

}
